package entidades;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;


@Entity
@Table
public class Compra {

	
	private Collection <CompraItem> itemsCompra;
	private int idCompra;
	private int precioTotal;
	private Date fechaCompra;
	private Collection <Factura> facturas;
	
	
	@Id
	@Column
	public int getIdCompra() {return idCompra;}
	
	@Column
	public int getPrecioTotal() {return precioTotal;}
	public void setPrecioTotal(int precioTotal) {this.precioTotal = precioTotal;}
	
	@Column
	public Date getFechaCompra() {return fechaCompra;}
	public void setFechaCompra(Date fechaCompra) {this.fechaCompra = fechaCompra;}
	
	@OneToMany(mappedBy="compra", fetch=FetchType.LAZY)
	public void setItemsCompra(Collection<CompraItem> itemsCompra) {this.itemsCompra = itemsCompra;}
	public void setIdCompra(int idCompra) {this.idCompra = idCompra;}

	@OneToMany(mappedBy="compra", fetch=FetchType.LAZY)
	public Collection<Factura> getFacturas() {return facturas;}
	public void setFacturas(Collection<Factura> facturas) {this.facturas = facturas;}
	
	

	
	
}

